package com.cxy.prototype;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
/**
 * 方法1: Address实现Cloneable接口
 * 方法2：Student实现Serializable接口
 */
public class Student implements Cloneable, Serializable {

    private String name;

    private Integer age;

    private Address address;

    @Override
    public Student clone() throws CloneNotSupportedException {
        Student student = (Student) super.clone();
        student.address = (Address) address.clone();
        return student;
    }

}
